import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class FinanceSecondManageService {

  serviceUrls = {
    secondOrderReportListUrl: '/mallOrder/findFinance', // 查询 - 二手订单报表
    exportSecondOrderReportUrl: '/mallOrder/findFinanceExcel', // 导出 - 二手订单报表

    secondSaleAfterReportListUrl: '/mallOrderRefund/findFinance', // 查询 - 二手售后报表
    exportSecondSaleAfterReportUrl: '/mallOrderRefund/findFinanceExcel', // 导出 - 二手售后报表

    secondPutReportListUrl: '/recycleMachine/findFinance', // 查询 - 二手入库报表
    exportSecondPutReportUrl: '/recycleMachine/findFinanceExcel', // 导出 - 二手入库报表

    secondOutReportListUrl: '/recycleDelivery/findFinance', // 查询 - 二手出库报表
    exportSecondOutReportUrl: '/recycleDelivery/findFinanceExcel' // 导出 - 二手出库报表
  }

  constructor(public httpClient: HttpClient) { }

  /**
   * ----------------------------------------------------------------
   * 二手订单报表
   * ----------------------------------------------------------------
   */

  // 查询 - 二手订单报表
  getSecondOrderReportList(params: any) {
    return this.httpClient.post(this.serviceUrls.secondOrderReportListUrl, params).toPromise();
  }

  // 导出 - 二手订单报表
  exportSecondOrderReportData(params: any) {
    return this.httpClient.post(this.serviceUrls.exportSecondOrderReportUrl, params, {responseType: 'blob'}).toPromise();
  }

  /**
   * ----------------------------------------------------------------
   * 二手售后报表
   * ----------------------------------------------------------------
   */

  // 查询 - 二手售后报表
  getSecondSaleAfterReportList(params: any) {
    return this.httpClient.post(this.serviceUrls.secondSaleAfterReportListUrl, params).toPromise();
  }

  // 导出 - 二手售后报表
  exportSecondSaleAfterReportData(params: any) {
    return this.httpClient.post(this.serviceUrls.exportSecondSaleAfterReportUrl, params, {responseType: 'blob'}).toPromise();
  }

  /**
   * ----------------------------------------------------------------
   * 二手入库报表
   * ----------------------------------------------------------------
   */

  // 查询 - 二手入库报表
  getSecondPutReportList(params: any) {
    return this.httpClient.post(this.serviceUrls.secondPutReportListUrl, params).toPromise();
  }

  // 导出 - 二手入库报表
  exportSecondPutReportData(params: any) {
    return this.httpClient.post(this.serviceUrls.exportSecondPutReportUrl, params, {responseType: 'blob'}).toPromise();
  }

  /**
   * ----------------------------------------------------------------
   * 二手入库报表
   * ----------------------------------------------------------------
   */

  // 查询 - 二手出库报表
  getSecondOutReportList(params: any) {
    return this.httpClient.post(this.serviceUrls.secondOutReportListUrl, params).toPromise();
  }

  // 导出 - 二手出库报表
  exportSecondOutReportData(params: any) {
    return this.httpClient.post(this.serviceUrls.exportSecondOutReportUrl, params, {responseType: 'blob'}).toPromise();
  }
}



